home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / controls / frmsize.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-05-16  |  1.7 KB  |  60 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Form Resizing Demonstration"
  5.    ClientHeight    =   3045
  6.    ClientLeft      =   2805
  7.    ClientTop       =   2205
  8.    ClientWidth     =   3900
  9.    Height          =   3450
  10.    Left            =   2745
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3045
  16.    ScaleWidth      =   3900
  17.    Top             =   1860
  18.    Width           =   4020
  19.    Begin CommandButton Command2 
  20.       Caption         =   "End"
  21.       Height          =   495
  22.       Left            =   1440
  23.       TabIndex        =   1
  24.       Top             =   2160
  25.       Width           =   1215
  26.    End
  27.    Begin CommandButton Command1 
  28.       Caption         =   "Enlarge Form"
  29.       Height          =   855
  30.       Left            =   1080
  31.       TabIndex        =   0
  32.       Top             =   600
  33.       Width           =   1935
  34.    End
  35. Option Explicit
  36. Sub CenterControls ()
  37.     'Keep the 2 controls centered on the screen.
  38.     command1.Move (form1.Width - command1.Width) / 2, .2 * form1.Height
  39.     command2.Move (form1.Width - command2.Width) / 2, .6 * form1.Height
  40. End Sub
  41. Sub CenterForm ()
  42.     'Center the form on the screen
  43.     form1.Move (screen.Width - form1.Width) / 2, (screen.Height - form1.Height) / 2
  44. End Sub
  45. Sub Command1_Click ()
  46.     form1.Width = form1.Width + 200
  47.     form1.Height = form1.Height + 200
  48.     CenterForm
  49.     CenterControls
  50. End Sub
  51. Sub Command2_Click ()
  52.     End
  53. End Sub
  54. Sub Form_Load ()
  55.     form1.Height = .5 * screen.Height
  56.     form1.Width = .5 * screen.Width
  57.     CenterForm
  58.     CenterControls
  59. End Sub
  60.